]> sigrok.org Git - libserialport.git/blobdiff - libserialport_internal.h
windows: Use an adaptively sized buffer for nonblocking writes.
[libserialport.git] / libserialport_internal.h
index a5fc7bc54bcebdcc639a9dbdf8470461eb612143..46c77a8b65446ebf6cbe07ceba4c210051f25ae4 100644 (file)
@@ -23,7 +23,9 @@
 
 
 #ifdef __linux__
-#define _BSD_SOURCE /* For timeradd, timersub, timercmp. */
+/* For timeradd, timersub, timercmp, realpath. */
+#define _BSD_SOURCE 1 /* for glibc < 2.19 */
+#define _DEFAULT_SOURCE 1 /* for glibc >= 2.20 */
 #endif
 
 #include <string.h>
@@ -50,7 +52,6 @@
 #include <termios.h>
 #include <sys/ioctl.h>
 #include <sys/time.h>
-#include <limits.h>
 #include <poll.h>
 #endif
 #ifdef __APPLE__
@@ -82,7 +83,7 @@
 #endif
 
 /* Non-standard baudrates are not available everywhere. */
-#if (defined(HAVE_TERMIOS_SPEED) || defined(HAVE_TERMIOS2_SPEED)) && defined(HAVE_DECL_BOTHER)
+#if (defined(HAVE_TERMIOS_SPEED) || defined(HAVE_TERMIOS2_SPEED)) && HAVE_DECL_BOTHER
 #define USE_TERMIOS_SPEED
 #endif
 
@@ -106,7 +107,8 @@ struct sp_port {
        OVERLAPPED read_ovl;
        OVERLAPPED wait_ovl;
        DWORD events;
-       BYTE pending_byte;
+       BYTE *write_buf;
+       DWORD write_buf_size;
        BOOL writing;
        BOOL wait_running;
 #else