120-cygwin_fixes.patch 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  1. --- a/squashfs-tools/mksquashfs.c
  2. +++ b/squashfs-tools/mksquashfs.c
  3. @@ -51,15 +51,22 @@
  4. #include <sys/wait.h>
  5. #ifndef linux
  6. +#ifndef __CYGWIN__
  7. #define __BYTE_ORDER BYTE_ORDER
  8. #define __BIG_ENDIAN BIG_ENDIAN
  9. #define __LITTLE_ENDIAN LITTLE_ENDIAN
  10. #include <sys/sysctl.h>
  11. +#endif /* __CYGWIN__ */
  12. #else
  13. #include <endian.h>
  14. #include <sys/sysinfo.h>
  15. #endif
  16. +#ifdef __CYGWIN__
  17. +#include <sys/termios.h>
  18. +#define FNM_EXTMATCH (1 << 5)
  19. +#endif
  20. +
  21. #ifndef FNM_EXTMATCH
  22. #define FNM_EXTMATCH 0
  23. #endif
  24. @@ -844,6 +851,7 @@ void sigusr1_handler()
  25. void sigwinch_handler()
  26. {
  27. +#ifndef __CYGWIN__
  28. struct winsize winsize;
  29. if(ioctl(1, TIOCGWINSZ, &winsize) == -1) {
  30. @@ -853,6 +861,9 @@ void sigwinch_handler()
  31. columns = 80;
  32. } else
  33. columns = winsize.ws_col;
  34. +#else
  35. + columns = 80;
  36. +#endif
  37. }
  38. @@ -4066,6 +4077,9 @@ void initialise_threads(int readb_mbytes
  39. signal(SIGUSR1, sigusr1_handler);
  40. +#ifdef __CYGWIN__
  41. + processors = atoi(getenv("NUMBER_OF_PROCESSORS"));
  42. +#else
  43. if(processors == -1) {
  44. #ifndef linux
  45. int mib[2];
  46. @@ -4087,6 +4101,7 @@ void initialise_threads(int readb_mbytes
  47. processors = sysconf(_SC_NPROCESSORS_ONLN);
  48. #endif
  49. }
  50. +#endif /* __CYGWIN__ */
  51. thread = malloc((2 + processors * 2) * sizeof(pthread_t));
  52. if(thread == NULL)
  53. --- a/squashfs-tools/read_fs.c
  54. +++ b/squashfs-tools/read_fs.c
  55. @@ -33,9 +33,11 @@
  56. #include <sys/mman.h>
  57. #ifndef linux
  58. +#ifndef __CYGWIN__
  59. #define __BYTE_ORDER BYTE_ORDER
  60. #define __BIG_ENDIAN BIG_ENDIAN
  61. #define __LITTLE_ENDIAN LITTLE_ENDIAN
  62. +#endif
  63. #else
  64. #include <endian.h>
  65. #endif
  66. --- a/squashfs-tools/swap.c
  67. +++ b/squashfs-tools/swap.c
  68. @@ -20,9 +20,11 @@
  69. */
  70. #ifndef linux
  71. +#ifndef __CYGWIN__
  72. #define __BYTE_ORDER BYTE_ORDER
  73. #define __BIG_ENDIAN BIG_ENDIAN
  74. #define __LITTLE_ENDIAN LITTLE_ENDIAN
  75. +#endif
  76. #else
  77. #include <endian.h>
  78. #endif
  79. --- a/squashfs-tools/unsquashfs.c
  80. +++ b/squashfs-tools/unsquashfs.c
  81. @@ -117,6 +117,7 @@ void update_progress_bar();
  82. void sigwinch_handler()
  83. {
  84. +#ifndef __CYGWIN__
  85. struct winsize winsize;
  86. if(ioctl(1, TIOCGWINSZ, &winsize) == -1) {
  87. @@ -126,6 +127,9 @@ void sigwinch_handler()
  88. columns = 80;
  89. } else
  90. columns = winsize.ws_col;
  91. +#else
  92. + columns = 80;
  93. +#endif
  94. }
  95. @@ -1807,7 +1811,9 @@ void initialise_threads(int fragment_buf
  96. if(sigprocmask(SIG_BLOCK, &sigmask, &old_mask) == -1)
  97. EXIT_UNSQUASH("Failed to set signal mask in intialise_threads"
  98. "\n");
  99. -
  100. +#ifdef __CYGWIN__
  101. + processors = atoi(getenv("NUMBER_OF_PROCESSORS"));
  102. +#else
  103. if(processors == -1) {
  104. #ifndef linux
  105. int mib[2];
  106. @@ -1829,6 +1835,7 @@ void initialise_threads(int fragment_buf
  107. processors = sysconf(_SC_NPROCESSORS_ONLN);
  108. #endif
  109. }
  110. +#endif /* __CYGWIN__ */
  111. thread = malloc((3 + processors) * sizeof(pthread_t));
  112. if(thread == NULL)
  113. --- a/squashfs-tools/unsquashfs.h
  114. +++ b/squashfs-tools/unsquashfs.h
  115. @@ -46,15 +46,22 @@
  116. #include <sys/time.h>
  117. #ifndef linux
  118. +#ifndef __CYGWIN__
  119. #define __BYTE_ORDER BYTE_ORDER
  120. #define __BIG_ENDIAN BIG_ENDIAN
  121. #define __LITTLE_ENDIAN LITTLE_ENDIAN
  122. #include <sys/sysctl.h>
  123. +#endif
  124. #else
  125. #include <endian.h>
  126. #include <sys/sysinfo.h>
  127. #endif
  128. +#ifdef __CYGWIN__
  129. +#include <sys/termios.h>
  130. +#define FNM_EXTMATCH (1 << 5)
  131. +#endif
  132. +
  133. #ifndef FNM_EXTMATCH
  134. #define FNM_EXTMATCH 0
  135. #endif