There were two issues: first, feature test macros were only defined
for __linux__, so defintions we needed were not included. Enable the
same feature test macros for __CYGWIN__.
Second, the Cygwin headers do not define TIOCOUTQ, needed to use
ioctl() to get the number of bytes in the output queue. Return
SP_ERR_SUPP on Cygwin for this operation.
This fixes bug #963.
#define _CRT_SECURE_NO_WARNINGS
#endif
-/* These Linux/glibc specific defines must appear before other headers.*/
-#ifdef __linux__
+/* These feature test macros must appear before other headers.*/
+#if defined(__linux__) || defined(__CYGWIN__)
/* For timeradd, timersub, timercmp, realpath. */
#define _BSD_SOURCE 1 /* for glibc < 2.19 */
#define _DEFAULT_SOURCE 1 /* for glibc >= 2.20 */
{
TRACE("%p", port);
+#ifdef __CYGWIN__
+ /* TIOCOUTQ is not defined in Cygwin headers */
+ RETURN_ERROR(SP_ERR_SUPP,
+ "Getting output bytes waiting is not supported on Cygwin");
+#else
CHECK_OPEN_PORT();
DEBUG_FMT("Checking output bytes waiting on port %s", port->name);
RETURN_FAIL("TIOCOUTQ ioctl failed");
RETURN_INT(bytes_waiting);
#endif
+#endif
}
SP_API enum sp_return sp_new_event_set(struct sp_event_set **result_ptr)