X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=support%2Fserial.c;h=ec02e48b5e8bd37a30601aa90c5332e9bcfecba1;hb=cafd968e0c109a7604217f5c6ebf433ef6d915a8;hp=4b8014bb6d9bb4f685e26ed33f25449bf7a6bbb3;hpb=2f953191fcb5d6e665e38d567a84284c92293631;p=mono.git diff --git a/support/serial.c b/support/serial.c index 4b8014bb6d9..ec02e48b5e8 100644 --- a/support/serial.c +++ b/support/serial.c @@ -21,7 +21,7 @@ #include /* This is for ASYNC_*, serial_struct on linux */ -#if defined(__linux__) +#if defined(HAVE_LINUX_SERIAL_H) #include #endif @@ -33,7 +33,12 @@ #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 #include #include @@ -383,7 +388,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__ || __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 @@ -400,7 +405,7 @@ set_attributes (int fd, int baud_rate, MonoParity parity, int dataBits, MonoStop return FALSE; if (custom_baud_rate == TRUE){ -#if defined(__linux__) +#if defined(HAVE_LINUX_SERIAL_H) struct serial_struct ser; if (ioctl (fd, TIOCGSERIAL, &ser) < 0) @@ -416,7 +421,7 @@ set_attributes (int fd, int baud_rate, MonoParity parity, int dataBits, MonoStop { return FALSE; } -#elif __APPLE__ +#elif defined(HAVE_IOKIT) speed_t speed = baud_rate; if (ioctl(fd, IOSSIOSPEED, &speed) == -1) return FALSE;