0001-Compile-with-libc-s-without-cispeed-cospeed.patch 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. From 30c712c5f14306460c44bea70e24419db9d44f8c Mon Sep 17 00:00:00 2001
  2. From: Nick Patavalis <npat@efault.net>
  3. Date: Thu, 12 Apr 2018 15:16:04 +0300
  4. Subject: [PATCH] Compile with libc's without cispeed / cospeed
  5. Some libc implementations (e.g. musl) do not define the cispeed and
  6. cospeed struct termios fields. So we have to check the
  7. _HAVE_STRUCT_TERMIOS_C_ISPEED and _HAVE_STRUCT_TERMIOS_C_OSPEED
  8. macros. If not defined, we disable custom baudrate support.
  9. [baruch: backported from upstream master to 3.1]
  10. Signed-off-by: Baruch Siach <baruch@tkos.co.il>
  11. ---
  12. Upstream status: commit 1acf1ddabaf3
  13. custbaud.h | 10 +++++++++-
  14. 1 file changed, 9 insertions(+), 1 deletion(-)
  15. diff --git a/custbaud.h b/custbaud.h
  16. index 48151a4a4e84..ae4ae8daf49e 100644
  17. --- a/custbaud.h
  18. +++ b/custbaud.h
  19. @@ -26,6 +26,8 @@
  20. #ifndef CUSTBAUD_H
  21. #define CUSTBAUD_H
  22. +#include <termios.h>
  23. +
  24. #ifndef NO_CUSTOM_BAUD
  25. #if defined (__linux__)
  26. @@ -33,7 +35,13 @@
  27. /* Enable by-default for kernels > 2.6.0 on x86 and x86_64 only */
  28. #include <linux/version.h>
  29. #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,0)
  30. -#if defined (__i386__) || defined (__x86_64__) || defined (USE_CUSTOM_BAUD)
  31. +/* Some libc implementations (e.g. musl) do not define the cispeed and
  32. + cospeed struct termios fields. We do not support custom baudrates
  33. + on them. */
  34. +#if ( (defined (__i386__) || defined (__x86_64__)) \
  35. + && defined (_HAVE_STRUCT_TERMIOS_C_ISPEED) \
  36. + && defined (_HAVE_STRUCT_TERMIOS_C_OSPEED) ) \
  37. + || defined (USE_CUSTOM_BAUD)
  38. #ifndef USE_CUSTOM_BAUD
  39. #define USE_CUSTOM_BAUD
  40. #endif
  41. --
  42. 2.16.3